package com.wxtl.action;

import com.wxtl.action.base.BaseAction;
import com.wxtl.action.qo.LoginUser;
import com.wxtl.entity.User;
import com.wxtl.service.UserService;
import com.wxtl.util.Page;

public class UserAction extends BaseAction {
	private User user=new User();
	private int[] ids;
	
	private LoginUser loginUser = new LoginUser();

	public LoginUser getLoginUser() {
		return loginUser;
	}

	public void setLoginUser(LoginUser loginUser) {
		this.loginUser = loginUser;
	}

	private UserService userService;
	
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}	
	
	public void setIds(int[] ids) {
		this.ids = ids;
	}

	public String add(){
		userService.add(user);
		return SUCCESS;
	}
	
	public String update(){
		userService.update(user);
		return SUCCESS;
	}
	
	public String delete(){
		userService.delete(ids);
		return SUCCESS;
	}
	
	public String query(){
		Page pageData=userService.query(super.getDataGrid(),user);
		setPageData(pageData);
		return SUCCESS;
	}
	
	public String modifyPwd(){
		userService.modifyPwd(loginUser);
		return SUCCESS;
	}
}
